
export function add(a,b){
  return a+b;
}

// 类似闭包了 返回函数用到了父级作用域的变量

console.log(this)
var initData =100
export function handleData(){

  //const initData =  100;

  const handleAdd =(x)=>{

    return initData = initData+x;

  }

  const handleMul =(x)=>{

    return initData = initData-x;
  }

  return {handleAdd,handleMul}

}

const CalObj ={

  initData: 100,

  add:function(x){
    return this.initData +x

  },
  mul:function(x){
    return this.initData-x;
  }
}

export default CalObj;
